package nowcoder.huawei;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author wuguojian
 * @description
 * https://www.nowcoder.com/practice/24e6243b9f0446b081b1d6d32f2aa3aa
 **/
public class HJ103 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new FileReader("input/nowcoder_huawei/HJ103.txt"));
//        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i] = in.nextInt();
            }
            int[] result = new int[n];
            int max = 0;
            for (int i = 1; i < n; i++) {
                for (int j = 0 ; j < i; j++){
                    if(nums[j] < nums[i]){
                        result[i] = Math.max(result[i], result[j]+1);
                    }
                }
            }
            Arrays.sort(result);
            System.out.println(result[result.length-1]+1);
        }
    }
}
